import {EntityId, PageQueryParams} from "kf-web-library";
import {FrontJournal, FrontJournalPeriod, Journal_Summary, User} from "@/services";

export interface FrontJournalSubscribePlanPageQueryParams extends Partial<PageQueryParams> {
  searchText?: string;
  ids?: EntityId[];
}

export interface FrontJournalSubscribePlanQueryParams {
  journalId?: EntityId;
}

export interface FrontJournalSubscribePlan {
  id: EntityId; //主键
  journal: Journal_Summary; //期刊
  planCode: string; //套餐代码
  planName: string; //套餐名称(如:季度套餐,年度套餐)
  issueCount: number; //包含期数
  originalPrice: number; //原始总价
  totalPrice: number; //套餐总价
  discountRate: number; //折扣率
  description: string; //套餐描述
  isRecommended: boolean; //是否推荐(1:是,0:否)
  enable: boolean; //状态(1:可用,0:不可用)
  createTime: string; //创建时间
  createUserId: number; //${column.comment}
  modifyTime: string; //修改时间
  modifyUserId: number; //${column.comment}

  originalUnitPrice: number; //套餐单期价
  unitPrice: number; //套餐单期价
}


export interface JournalSubscribe_Request {
  displayType: string; //订阅呈现类型 SubscribeDisplayType
  timeType: string; //订阅时间类型 SubscribeTimeType
  journalId: string; //期刊ID
  planId: number; //订阅套餐ID
  periodIds?: number[]; //刊期ID集合
  payway: string; //支付方式 内容为数字的字符串 2:支付宝3:微信
}


export interface JournalSubscribe_Response {
  isSuccess: boolean; //是否成功
  orderNo: string; //订单编号
  subject: string; //订单subject
  payway: string; //支付方式 内容为数字的字符串 2:支付宝3:微信
  qrCode: string; //二维码图片地址
  qrCodeImageUrl: string; //二维码图片地址
  expirationSecond: number; //支付有效期
  totalAmount: string; //交易总额
  netAmount: string; //实收金额

  qrCodeIcon?: string;  //不是后台反的,二维码中间的小图标
  paywayStr?: React.ReactNode;  //不是后台反的,payway的中文名称
}


export interface FrontMineJournalSubscribeQueryParams extends Partial<PageQueryParams> {

}




export interface FrontPayOrder{
  id: EntityId; //主键
  orderNo: string; //订单编号
  displayType: string; //订阅呈现类型
  timeType: string; //订阅时间类型
  userId: number; //用户ID
  journalId: string; //期刊ID
  planId: number; //订阅套餐ID
  periodIds: number[]; //刊期ID集合
  planName: string; //套餐名称
  periodCount: number; //包含期数
  totalPrice: number; //套餐总价
  originalAmount: number; //原始金额
  discountAmount: number; //折扣金额
  actualAmount: number; //实际支付金额
  discountRate: number; //折扣率
  status: string; //状态(待支付,已支付,已取消,已过期)
  paymentMethod: string; //支付方式(支付宝,微信,银行卡)
  paymentTime: string; //支付时间
  paymentTransactionId: string; //收钱吧交易流水号
  createTime: string; //创建时间
  createUserId: number; //${column.comment}
  modifyTime: string; //修改时间
  modifyUserId: number; //${column.comment}
}

export interface FrontJournalSubscribe{
  id: EntityId; //主键
  displayType: string; //订阅呈现类型
  timeType: string; //订阅时间类型
  user: User; //用户
  order: FrontPayOrder; //订单
  journal: FrontJournal; //期刊
  plan: JournalSubscribePlan; //订阅套餐
  periodCount: number; //包含期数（冗余）
  periodListCount: number; //已交付刊期数量
  subscribeDate: string; //订阅日期
  status: string; //订阅状态(有效,已用完/过期)
  isAutoRenew: boolean; //是否自动续订(1:是,0:否)
  seq: number; //排序
  createTime: string; //创建时间
  createUserId: number; //${column.comment}
  modifyTime: string; //修改时间
  modifyUserId: number; //${column.comment}
  shippingCount: number; //已发送期数
}

export interface FrontJournalSubscribeDetail{
  id: EntityId; //主键
  displayType: string; //订阅呈现类型
  timeType: string; //订阅时间类型
  user: User; //用户
  order: FrontPayOrder; //订单
  journal: FrontJournal; //期刊
  plan: JournalSubscribePlan; //订阅套餐
  periodList: FrontJournalPeriod[]; //(已生效的)刊期集合
  periodListCount: number; //已交付刊期数量
  periodCount: number; //包含期数（冗余）
  subscribeDate: string; //订阅日期
  status: string; //订阅状态(有效,已用完/过期)
  isAutoRenew: boolean; //是否自动续订(1:是,0:否)
  seq: number; //排序
  createTime: string; //创建时间
  createUserId: number; //${column.comment}
  modifyTime: string; //修改时间
  modifyUserId: number; //${column.comment}
  shippingCount: number; //已发送期数
  shippingRecordList: FrontShippingRecord[]; //已发送期数
}

export interface JournalSubscribePlan{
  id: EntityId; //主键
  journal: FrontJournal; //期刊
  planCode: string; //套餐代码
  planName: string; //套餐名称(如:季度套餐,年度套餐)
  issueCount: number; //包含期数
  originalPrice: number; //原始总价
  totalPrice: number; //套餐总价
  discountRate: number; //折扣率
  description: string; //套餐描述
  isRecommended: boolean; //是否推荐(1:是,0:否)
  enable: boolean; //状态(1:可用,0:不可用)
  seq: number; //排序号
  createTime: string; //创建时间
  createUserId: number; //${column.comment}
  modifyTime: string; //修改时间
  modifyUserId: number; //${column.comment}
}


export interface FrontShippingRecord{
  id: number; //主键
  subscribe: FrontJournalSubscribe; //订阅记录表
  shippingType: string; //发送类型
  period: FrontJournalPeriod; //刊期
  shippingTime: string; //发货时间
  shippingUser: User; //发货人
  logisticsCompany: string; //物流公司
  trackingNumber: string; //运单号
  email: string; //接收邮箱
  ignoreStatus: boolean; //是否忽略状态发货
}

export interface FrontPayRecord{
  id: EntityId; //主键
  orderId: number; //关联订单ID
  orderNo: string; //订单编号
  transactionId: string; //收钱吧交易流水号
  paymentMethod: string; //支付方式(支付宝,微信,银行卡)  PaymentMethod
  paymentAmount: number; //支付金额
  paymentStatus: string; //支付状态(处理中,成功,失败)  PayStatus
  paymentTime: string; //支付完成时间
}




